import { Controller, Get, Post, Body, Patch, Param, Delete, Header, HttpCode } from '@nestjs/common';
import { PlayWithService } from './play-with.service';
import { CreatePlayWithDto } from './dto/create-play-with.dto';
import { UpdatePlayWithDto } from './dto/update-play-with.dto';

@Controller('play-with')
export class PlayWithController {
  constructor(private readonly playWithService: PlayWithService) { }

  //新增
  @Post("save")
  @HttpCode(200)
  create(@Body() createPlayWithDto: CreatePlayWithDto) {
    return this.playWithService.create(createPlayWithDto);
  }

  //分页查询list
  @Post('list')
  @Header('Content-Type', 'application/json')
  @HttpCode(200)
  findAll(@Body('pageNum') pageNum: number,
    @Body('pageSize') pageSize: number,
    @Body('playWithName') playWithName: string,) {
    return this.playWithService.findAll(pageNum, pageSize, playWithName);
  }
  //详情
  @Post('/detail')
  @HttpCode(200)
  findOne(@Body('playWithId') playWithId: string) {
    return this.playWithService.findOne(playWithId);
  }

  //更新
  @Post('update')
  @HttpCode(200)
  update(@Body('playWithId') playWithId: string, @Body() updatePlayWithDto: UpdatePlayWithDto) {
    return this.playWithService.update(playWithId, updatePlayWithDto);
  }
  //删除
  @Post('remove')
  @HttpCode(200)
  remove(@Body('playWithId') playWithId: string) {
    return this.playWithService.remove(playWithId);
  }
}
